<!--#INCLUDE FILE="conn.asp"-->
<!-- #include file="aFunction_charCode.asp" -->
<!-- #include file="ad_comSub.asp" -->

<%
Call tslt_useridentity12_error_end()

if request("isshowlist")="ok" then
       call MYListCount(request("indexshowlist"),request("showlist"))
end if
if request("isInterval")="ok" then
       call MYInterval(request("MySI"))
end if
if request("isfiltrate")="ok" then
       call MYfiltrate(request("subjectfiltrate"))
end if
if request("isdel")="ok" then
       call MYdel(request("delyear"),request("delday"))
end if
If request("isPhotoSize")="ok" Then 
       Call MYUserPS(request("userPhotoSize"))
End If
If request("isTempTop")="ok" Then 
    Call MYTempTop(request("chk_tempTop"),request("text_tempTop"))
End If

Call conn_Nothing()

sub MYListCount(aaa,bbb)
     aaa=Int(aaa)
     bbb=Int(bbb)
     if aaa="" and bbb="" then
            Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(0))</SCRIPT>"
            Response.end  
     end if
     if not isnumeric(aaa) or not isnumeric(bbb) then
            Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(1))</SCRIPT>"
            Response.end  
     end if
     dim strSQL,objRS
     strSQL = "SELECT indexshowlist,showlist FROM option1"
     Set objRS = Server.CreateObject("ADODB.Recordset")
     objRS.Open strSQL,Conn
              if aaa<>"" then 
                    strSQL= "update option1 set indexshowlist=" & aaa 
                    conn.execute(strSQL)
                    Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(2))</SCRIPT>" & aaa & "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(3))</SCRIPT>"
              end if
              if bbb<>"" then
                    strSQL= "update option1 set showlist=" & bbb
                    conn.execute(strSQL)
                    Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(4))</SCRIPT>" & bbb & "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(5))</SCRIPT>"
              end if
       objRS.close
       Set objRS = Nothing
       Response.write"<META HTTP-EQUIV='Refresh' content='3; URL=rfd.asp'>"
end sub

sub MYInterval(aaa)
       aaa=Int(aaa)
       if aaa="" then
              Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(0))</SCRIPT>"
              Response.end  
       end if
       if not isnumeric(aaa) then
              Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(1))</SCRIPT>"
              Response.end  
       end if
       dim SQL,RS
       SQL = "SELECT SubmitInterval FROM option1"
       Set RS = Server.CreateObject("ADODB.Recordset")
       RS.Open SQL,Conn
               if aaa<>"" then 
                      SQL= "update option1 set SubmitInterval=" & aaa 
                      conn.execute(SQL)
                      Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(6))</SCRIPT>" & aaa & "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(7))</SCRIPT>"
               end if
       RS =RS.close
       Set RS = Nothing
       Response.write"<META HTTP-EQUIV='Refresh' content='3; URL=rfd.asp'>"
end sub

sub MYfiltrate(aaa)
       aaa= MyRecursion(aaa)
       dim strSQL,objRS
       strSQL = "SELECT SubjectFiltrate FROM option1"
       Set objRS = Server.CreateObject("ADODB.Recordset")
       objRS.Open strSQL,Conn,1,2
               If Not objRS.Eof Then
                     objRS("SubjectFiltrate")=aaa
                     objRS.update
               End If
               If aaa = "" Then 
                     Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(8))</SCRIPT>"
               Else
                     Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(9))</SCRIPT>" &aaa& "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(10))</SCRIPT>"
               End If 
       objRS.close
       Set objRS = Nothing
       Response.write"<META HTTP-EQUIV='Refresh' content='3; URL=rfd.asp'>"
end sub

function MyRecursion(bbb)
       if Right(bbb,1)="|" then
              bbb=Left(bbb,Len(bbb)-1)
              call MyRecursion(bbb)
       end if
        MyRecursion=bbb
end function

sub MYdel(yyy,ddd)
       yyy=left(yyy,4)
       if yyy="" and ddd="" then
              Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(0))</SCRIPT>"
              Response.end  
       end if
       if not isnumeric(yyy) and not isnumeric(ddd) then
              Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(1))</SCRIPT>"
              Response.end  
       end if
       if yyy<>"" then
             if yyy<0 then
                    Response.write "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(11))</SCRIPT>"
                    Response.end  
             end if
       end if
       if ddd<>"" then
              if ddd<0 then
                    Response.write "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(11))</SCRIPT>"
                    Response.end  
              end if
       end if
       if yyy<>"" then
              call MyDelyear(yyy)
       end if
       if ddd<>"" then
              call MyDelday(ddd)
       end if
end sub

sub MyDelyear(yyy)
         set rs=server.createobject("adodb.recordset")
         sql = "select * FROM article WHERE left(AddTime,4)<'" & yyy & "' and jinghua = false and topfirst = false and top1 = false and adminindex = false and board_bulletin=false Order By id DESc"
         rs.Open sql,conn,1,2
               do while not rs.eof
                     set Rs1=server.createobject("adodb.recordset")
                     Sql1 = "SELECT d_SavePathFileName FROM article WHERE id = " & rs("id")
                     Rs1.Open Sql1, Conn, 0, 1
                             Dim d_SavePathFileName2
                             If Not Rs1.Eof Then
                                     d_SavePathFileName2 = Rs1("d_SavePathFileName")
                             End If
                             Dim aSavePathFileName
                             aSavePathFileName = Split(d_SavePathFileName2, "|")
                              Dim i
                              For i = 0 To UBound(aSavePathFileName)
                                    Call DoDelFile(aSavePathFileName(i))
                              Next
                      rs.movenext
                     Rs1.Close
                     Set Rs1=Nothing
                loop 
                set rs=server.createobject("adodb.recordset")
                sql = "select * FROM article WHERE left(AddTime,4)<'" & yyy & "' and jinghua = false and topfirst = false and top1 = false and adminindex = false and board_bulletin=false Order By id DESc"
                rs.Open sql,conn,1,2
                     do while not rs.eof
                           set rs2=server.createobject("adodb.recordset")
                           Sql2 = "SELECT r_SavePathFileName FROM reply WHERE cstr(reply_id)= " & rs("id")
                           Rs2.Open Sql2, Conn, 0, 1
                                  do while not rs2.eof
                                        Dim r_SavePathFileName2
                                        If Not Rs2.Eof Then
                                               r_SavePathFileName2 = Rs2("r_SavePathFileName")
                                        End If
                                        Dim bSavePathFileName
                                        bSavePathFileName = Split(r_SavePathFileName2, "|")
                                        Dim j
                                        For j = 0 To UBound(bSavePathFileName)
                                              Call DoDelFile(bSavePathFileName(j))
                                        Next
                                        rs2.movenext
                                   loop
                                   conn.Execute("delete FROM reply WHERE cstr(reply_id)= " & rs("id"))
                           rs.movenext
                           Rs2.Close
                           Set Rs2=Nothing
                     loop
                     conn.Execute( "delete FROM article WHERE left(AddTime,4)<'" & yyy & "' and jinghua = false and topfirst = false and top1 = false and adminindex = false and board_bulletin=false")

	    dim fso,d
	    set fso=server.createobject("scripting.filesystemobject")
	    drvpath=server.mappath("../ewebeditor/UploadFile") 		
	    set d=fso.getfolder(drvpath)
	    set fc=d.files
	    for each f1 in fc
                           yearfilename=f1.name
                           if left(yearfilename,4)<yyy then
                                  dim fso2,d2,drvpath2,rootpath		
        	                set fso2=server.createobject("scripting.filesystemobject")
        	                drvpath2=server.mappath(".\")
         	                drvpath2=left(drvpath2,(instrrev(drvpath2,"\")-1))
        	                set d2=fso2.getfolder(drvpath2) 	
                                  rootpath=d2.path
                                  rootpath=right(rootpath,(instrrev(rootpath,"\")+1))
                                  yearfilename= rootpath &"/ewebeditor/UploadFile/" & yearfilename
                                  Call DoDelFile(yearfilename)
                          end if
	    next
                      set fso=nothing
                      set fso2=nothing

                      Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(12))</SCRIPT>" & yyy & "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(13))</SCRIPT>"
                      Response.write"<META HTTP-EQUIV='Refresh' content='3;URL=rfd.asp'>"
        rs.Close
        Set rs=Nothing
end sub

sub MyDelday(ddd)
        set rs=server.createobject("adodb.recordset")
        sql = "select * FROM article WHERE AddTime<cdate('" & clng(now)-ddd & "') and jinghua = false and topfirst = false and top1 = false and adminindex = false and board_bulletin=false Order By id DESc"
        rs.Open sql,conn,1,2
                do while not rs.eof
                      set Rs1=server.createobject("adodb.recordset")
                      Sql1 = "SELECT d_SavePathFileName FROM article WHERE id = " & rs("id")
                      Rs1.Open Sql1, Conn, 0, 1
                               Dim d_SavePathFileName2
                               If Not Rs1.Eof Then
                                      d_SavePathFileName2 = Rs1("d_SavePathFileName")
                               End If
                               Dim aSavePathFileName
                               aSavePathFileName = Split(d_SavePathFileName2, "|")
                               Dim i
                               For i = 0 To UBound(aSavePathFileName)
                                      Call DoDelFile(aSavePathFileName(i))
                               Next
                      rs.movenext
                      Rs1.Close
                      Set Rs1=Nothing
                 loop 
                 set rs=server.createobject("adodb.recordset")
                 sql = "select * FROM article WHERE AddTime<cdate('" & clng(now)-ddd & "') and jinghua = false and topfirst = false and top1 = false and adminindex = false and board_bulletin=false Order By id DESc"
                 rs.Open sql,conn,1,2
                       do while not rs.eof
                             set rs2=server.createobject("adodb.recordset")
                             Sql2 = "SELECT r_SavePathFileName FROM reply WHERE cstr(reply_id)= " & rs("id")
                             Rs2.Open Sql2, Conn, 0, 1
                                     do while not rs2.eof
                                           Dim r_SavePathFileName2
                                           If Not Rs2.Eof Then
                                                 r_SavePathFileName2= Rs2("r_SavePathFileName")
                                           End If
                                           Dim bSavePathFileName
                                           bSavePathFileName = Split(r_SavePathFileName2, "|")
                                           Dim j
                                           For j = 0 To UBound(bSavePathFileName)
                                                  Call DoDelFile(bSavePathFileName(j))
                                           Next
                                           rs2.movenext
                                     loop
                                     conn.Execute("delete FROM reply WHERE cstr(reply_id)= " & rs("id"))
                            rs.movenext
                            Rs2.Close
                            Set Rs2=Nothing
                      loop
                      conn.Execute("delete FROM article WHERE AddTime<cdate('" & clng(now)-ddd & "') and jinghua = false and topfirst = false and top1 = false and adminindex = false and board_bulletin=false")
                      Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(14))</SCRIPT>" & ddd & "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(15))</SCRIPT>"
                      Response.write"<META HTTP-EQUIV='Refresh' content='3;URL=rfd.asp'>"
        rs.Close
        Set rs=Nothing
end sub

Sub MYUserPS(UserPS)
    If UserPS="" Then 
        Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(0))</SCRIPT>"
        Response.End   
    End If 
    UserPS=Int(UserPS)
    Dim SQL,RS
    SQL = "SELECT photoSize FROM option1"
    Set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open SQL,Conn
        If UserPS<>"" Then  
            SQL= "update option1 set photoSize=" & UserPS 
            conn.execute(SQL)
            Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(16))</SCRIPT>" & UserPS & "<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(17))</SCRIPT>"
        End If
    RS =RS.close
    Set RS = Nothing
    Response.write"<META HTTP-EQUIV='Refresh' content='3; URL=rfd.asp'>"
End Sub 

Sub MYTempTop(aaa,bbb)
    dim SQL,RS
    SQL = "SELECT SubmitInterval FROM option1"
    Set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open SQL,Conn
        If aaa="on" And bbb<>"" Then
            SQL= "update option1 set TempTopYes=true,TempTopCount=" & bbb 
            conn.execute(SQL)
            Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(18))</SCRIPT>"
		Else
            SQL= "update option1 set TempTopYes=false,TempTopCount=0"
            conn.execute(SQL)
            Response.write"<SCRIPT language=Javascript>passwords(promptInfo_rfd_handle(19))</SCRIPT>"
        End If
    RS = RS.close
    Set RS = Nothing
    Response.write"<META HTTP-EQUIV='Refresh' content='3; URL=rfd.asp'>"
End Sub 

%>
